<?php
loadTemp("admin/models/permission/permission_header.php");
?>
<script type="text/javascript">
$(document).ready(function(){
	loadAdminTopItem();
	activeAdminTopItem("s_c_add_group");
	$("#extend_group_temple").hide();
});
</script>
<?php checkAdminPermission("admin.permission.add_group","admin.class.*");?>
<!-- Start -->
<script type="text/javascript">
$(document).ready(function(){
	
});
function s_addgroup_onSuccess(data){
	console.log(data);
	s_addgroup_operatedone(data.code,data.message,data.data);
}
function s_addgroup_onError(data){
	console.log(data);
	s_addgroup_operatedone(-101,"服务器返回了未知的数据，请上报管理员",data.responseText);
}
function s_addgroup_operatedone(id,message,data){
	if(id==-101){
		showMessage("s_addgroup_message",-101,message+"<br><br><pre>"+data+"</pre>");
		return;
	}
	if(id!=0&&id!=3){
		showMessage("s_addgroup_message",id,message);
	}
	if(id==0){
		showMessage("s_addgroup_message",id,message);
	}
}
function a_a_p_addGroup(data){
	return $data;
}
function searchExtendGroup(e){
	$gname = e.attr("value");
}
</script>
<div class="s_admin_in_container">
	<h2 class="ui dividing header">增加权限组</h2>
	<div class="ui message">
		<div class="header">小提示</div>
		<ul class="list">
			<li>你可以在这里增加管理组</li>
		</ul>
	</div>
	<div class="ui message hidden" id="s_addgroup_message"></div>
	<form class="ui form admin_form" url="admin.php?mod=member&ajax=true&op=add_user" id="form_add_user">
		<h4 class="ui dividing header">添加用户组</h4>
		<div class="field">
			<label>用户组名称</label>
			<div class="field">
				<input id="groupname" type="text" name="groupname" placeholder="组名">
			</div>
			<div class="inline fields">
				<div class="field">
					<label>是否为管理员权限组：</label>
					<div class="ui radio checkbox" id="c_false">
						<input type="radio" name="isBanned" value="0" class="hidden">
						<label>是</label>
					</div>
				</div>
				<div class="field">
					<div class="ui radio checkbox" id="c_true">
						<input type="radio" name="isBanned" value="1" class="hidden">
						<label id="bantime"> 否 </label>
					</div>
				</div>
			</div>
			<label>继承组列表</label>
			<table class="ui unstackable table">
				<thead>
					<tr>
						<th>组id</th>
						<th>组名</th>
						<th>生效</th>
					</tr>
				</thead>
				<tbody id="extend_groups">
					<tr>
						<td>
							<input type="text" placeholder="增加个新的组">
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		<button type="submit" class="ui submit button" tabindex="0">提交</button>
	</form>
</div>
<tr id="extend_group_temple">
	<td class="g_id">1</td>
	<td class="g_name">admingroup</td>
	<td>
		<div class="ui checkbox">
			<input type="checkbox" checked="checked" name="extends" value="1" class="hidden">
			<label id="bantime"> 生效 </label>
		</div>
	</td>
</tr>